﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;

namespace UygulamaTakbisService
{
    public class ExceptionLogDao : IDisposable
    {
        public void HataLogYaz(string ex)
        {
            string path = System.AppDomain.CurrentDomain.BaseDirectory + "Log\\ExceptionLog.txt";
            List<string> textList = new List<string>();
            using (StreamReader sr = new StreamReader(path))
            {
                string line = null;
                while ((line = sr.ReadLine()) != null)
                    textList.Add(line);
            }
            textList.Add(ex);
            using (StreamWriter sw = new StreamWriter(path))
            {
                foreach (string text in textList)
                    sw.WriteLine(text);
                sw.Close();
            }
        }

        public void Dispose()
        {
        }
    }
}
